package com.meihua.shellapp.activity.wallet;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.meihua.shellapp.R;
import com.meihua.shellapp.adapter.personalcenter.MyFragmentPagerAdapter;
import com.meihua.shellapp.base.BaseActivity;
import com.meihua.shellapp.fragment.policy.CurrentMonthFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * 累计收入
 */
public class DincomeActivity extends BaseActivity {
    @Bind(R.id.dincome_tabs)
    TabLayout mTabs;
    @Bind(R.id.dincome_vpager)
    ViewPager mViewpager;
    @Bind(R.id.tv_title)
    TextView tvTitle;
    @Bind(R.id.iv_top_left)
    ImageView mIVTopLeft;

    private List<Fragment> mFragments = new ArrayList<>();

    @Override
    public int getLayoutId() {
        return R.layout.activity_dincome;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        tvTitle.setVisibility(View.VISIBLE);
        tvTitle.setText("累计收入");
        mIVTopLeft.setVisibility(View.VISIBLE);

        List<String> type = new ArrayList<>();
        type.add("当月收入");
        type.add("工资列表");
        type.add("提现记录");
        mFragments.add(new CurrentMonthFragment().setType(1));
        mFragments.add(new CurrentMonthFragment().setType(2));
        mFragments.add(new CurrentMonthFragment().setType(3));
       /*设置tab+vp*/
        MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), type, mFragments);
        mViewpager.setAdapter(adapter);
        adapter.notifyDataSetChanged();
        mTabs.setupWithViewPager(mViewpager);
    }

    @OnClick(R.id.iv_top_left)
    public void onViewClicked() {
        finish();
    }
}
